<?php

 defined('DB_SERVER') ? null : define("DB_SERVER", "arc12.db.11271867.hostedresource.com");
 defined('DB_USER')   ? null : define("DB_USER"  , "arc12");
 defined('DB_PASS')   ? null : define("DB_PASS"  , "Heartland1@");
 defined('DB_NAME')   ? null : define("DB_NAME"  , "arc12");


class MYSQL
{

		public $dbh;	
		private static $instance;
		
		private function __construct()
		{
			try
			{
				$this->dbh = new PDO('mysql:host=' . DB_SERVER . ';dbname='. DB_NAME, DB_USER, DB_PASS);
				$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
			}
			catch(PDOException $e) {
				echo 'ERROR: ' . $e->getMessage();
			}	
		} 
		
		public function closeConnection()
		{
			$dbh = null;
		}	
		
		public static function getInstance() 
		{
			if (!isset(self::$instance))
			{
				$object = __CLASS__;
				self::$instance = new $object;
			}
			return self::$instance;
		}
} 
